import req from '@/utils/req';

// 获取分页查询后的学生成绩 接口： /score/findPageStudentScore?currentPage={currentPage}&limit={limit}
export const reqFindPageStudentScore = (currentPage,limit) => req.get(`/score/findPageStudentScore?currentPage=${currentPage}&limit=${limit}`)

// 根据姓名获取成绩 接口： /score/findStudentName?studentName={studentName}
export const reqFindStudentName = (studentName) => req.get(`/score/findStudentName?studentName=${studentName}`)

// 根据课程和分数查询成绩 接口：/score/findStudentSubjectScore?subject={subject}&score={score}
export const reqFindStudentSubjectScore = (subject,score) => req.get(`/score/findStudentSubjectScore?subject=${subject}&score=${score}`)

// 添加和修改成绩 接口：登录：/score/addStudentScore ------------ 修改：/score/updateStudentScore
export const reqAddOrUpdateStudentScore = (scoreInfo) => {
  if(scoreInfo.scoreId){
    return req.post('/score/updateStudentScore',scoreInfo)
  }else{
    return req.post('/score/addStudentScore',scoreInfo)
  }
}

// 删除单个成绩 接口： /score/deleteStudentScore?scoreId={scoreId}
export const reqDeleteStudentScore = (scoreId) => req.delete(`/score/deleteStudentScore?scoreId=${scoreId}`)

// 批量删除成绩 接口： /score/batchDeleteStudentScore?scoreId={scoreId}
export const reqBatchDeleteStudentScore = (scoreIdArr) => req.delete(`/score/batchDeleteStudentScore?scoreIdArr=${scoreIdArr}`)